bitkeeper revision 1.1074 (40f3b27b9znWwwTVgEKSTwPzTJCS0w)
authormjw@wray-m-3.hpl.hp.com <mjw@wray-m-3.hpl.hp.com>
Tue, 13 Jul 2004 09:59:23 +0000 (09:59 +0000)
committermjw@wray-m-3.hpl.hp.com <mjw@wray-m-3.hpl.hp.com>
Tue, 13 Jul 2004 09:59:23 +0000 (09:59 +0000)
Check Twisted version.

tools/misc/xend

index 06006490a4ec885c3204159a59cc2ec1991376b6..232505e3b34255b2ee0931f19d974e035ee8320d 100644 (file)
@@ -22,7 +22,25 @@ import os
 import sys
 from xen.xend.server import SrvDaemon
 
+def check_twisted_version():
+    """Check twisted version and print a warning if not high enough.
+    """
+    from twisted.copyright import version
+    # Supported twisted release and major version.
+    RELEASE = 1
+    MAJOR   = 3
+    (release, major, minor) = version.split('.')
+    release = int(release)
+    major = int(major)
+    if release > RELEASE: return
+    if release == RELEASE and major >= MAJOR: return
+    print >>sys.stderr, "*" * 60
+    print >>sys.stderr, "*" * 3, "Warning: Twisted version not supported: %s" % version
+    print >>sys.stderr, "*" * 3, "Use Twisted version %d.%d.0 or higher" % (RELEASE, MAJOR)
+    print >>sys.stderr, "*" * 60
+
 def main():
+    check_twisted_version()
     daemon = SrvDaemon.instance()
     if not sys.argv[1:]:
         print 'usage: %s {start|stop|restart}' % sys.argv[0]